package com.zdw.demo.controller;

import com.zdw.common.parent.JSONResult;
import com.zdw.demo.config.international.InternationalUtils;
import com.zdw.demo.dto.TestDto;
import com.zdw.demo.service.TestDynamicService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 测试多数据源 前端控制器
 * </p>
 *
 * @author 卓德文
 * @since 2023-04-05
 */
@RestController
@RequestMapping("/testDynamic")
public class TestDynamicController {

    @Resource
    private TestDynamicService testDynamicService;

    /**
     * 测试多数据源、多数据源的事务问题
     *
     * @param testDto
     * @return
     */
    @PostMapping("/test")
    @ApiOperation("测试多数据源及事务")
    public JSONResult testDynamic(@RequestBody TestDto testDto) {
        return new JSONResult().markSuccess(InternationalUtils.getInternational("common.success"), testDynamicService.testDynamic(testDto));
    }

}
